<div class="form_title">Search Debit Memo</div>
  <?php echo form_tag('debitMemo/doSearch',array('id'=>'debitMemoSearchForm',))?>
  <?php echo $debitMemoSearchForm['_csrf_token']?>
    <table class="form">
      <tr>
        <th class="field">Debit Memo#</th>
        <td class="field">
          <?php echo $debitMemoSearchForm['debit_type']?>
          <?php echo $debitMemoSearchForm['debit_number_from']?> - 
          <?php echo $debitMemoSearchForm['debit_number_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Debit Date</th>
        <td class="field">
          <?php echo $debitMemoSearchForm['debit_date_from']?> - 
          <?php echo $debitMemoSearchForm['debit_date_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Invoice#</th>
        <td class="field">
          <?php echo $debitMemoSearchForm['invoice_type']?>
          <?php echo $debitMemoSearchForm['invoice_number_from']?> - 
          <?php echo $debitMemoSearchForm['invoice_number_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Name</th>
        <td class="field">
          <?php echo $debitMemoSearchForm['customer_name']?>
          <div id="debitMemoShowVoidOnly">
          <?php echo $debitMemoSearchForm['show_void_only']->renderLabel()?>
          <?php echo $debitMemoSearchForm['show_void_only']?>
          </div>
        </td>
      </tr>
    </table>
    <center>
      <input type="submit" value="Search"/> | 
      <input type="reset" value="Reset"/>
    </center>
  </form>
<div id="debitMemoSearchGrid">
</div>
<a href="#" id="debitMemoShowGrid" style="display:none">Show Search Results</a>
<div id="debitMemoPanel" style="display:none;">
</div>

<script language="javascript">
  $(document).ready(
    function(){
      $('#debitMemoSearchForm').submit(
        function(){
          showStatusWindow();
          $(this).ajaxSubmit(
            {
              type: 'post',
              dataType: 'html',
              success: 
              function(data,statusText){
                $('#debitMemoSearchGrid').html(data);
                $('#debitMemoSearchGrid').show();
                $('#debitMemoPanel').hide();
                $('#debitMemoFormDiv').remove();
                $('#debitMemoShowGrid').hide();
                hideStatusWindow();
              },
            }
          );
          return false;
        }
      );
      $('#debitMemoShowGrid').click(
        function(e){
          $(this).hide();
          $('#debitMemoSearchGrid').show();
          $('#debitMemoPanel').hide();
          $('#debitMemoFormDiv').remove();
          e.preventDefault();
        }
      );
    }
  );
</script>
